package com.wang.interview.designmode.template;

/**
 * @author: wang
 * @date: 2021/8/1 19:33
 * @description:
 */
public abstract class Template {

    public void calTime(){

        long first = System.currentTimeMillis();
        work();
        long last = System.currentTimeMillis();
        System.out.println("消耗时间为："+ (last-first)+" ms");
    }

    /***
    * Desc:子类实现，用calTime计算此方法消耗的时间
     * @param
    * @return
    * @author wang
    * @date 2021/8/1 19:36
    */
    abstract void work();
}
